package com.qf.czh.vhr.exception;

import com.qf.czh.vhr.entity.RespBean;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(SQLIntegrityConstraintViolationException.class)
    public RespBean sQLIntegrityConstraintViolationException (SQLIntegrityConstraintViolationException e){
        RespBean respBean = RespBean.error("有关联数据,有外键,删除失败");
        return respBean;
    }
}
